<script setup lang="tsx">
import { reactive } from 'vue'
// import type { TableData } from '@/api/table/types'
import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
import { onMounted } from 'vue'
// import { departmentMap } from '../../../../../public/department'
import { inject } from 'vue'

const  departmentMap  = inject<any>('departmentMap')

const props = defineProps({
  currentRow: {
    type: Object,
    required: true
  }
})

// const id = ref('')

const schema = reactive<DescriptionsSchema[]>([
  {
    field: 'entityName',
    label: '实体名称',
    span: 24
  },
  {
    field: 'code',
    label: '统一识别代码',
    span: 24
  },
  {
    field: 'entityId',
    label: '实体业务ID',
    span: 24
  },
  {
    field: 'department',
    label: '数据归属部门',
    slots: {
      default: () => {
        return (
          <span>
            {props.currentRow.department == '/' ? '/' : departmentMap[props.currentRow.department]}
          </span>
        )
      }
    }
  },
  {
    field: 'registerTime',
    label: '编码时间',
    slots: {
      default: () => {
        return (
          <span>
            {props.currentRow.registerTime == '/'
              ? '/'
              : new Date(props.currentRow.registerTime).toLocaleString('zh-CN', { timeZone: 'UTC' })}
          </span>
        )
      }
    }
  },
  {
    field: 'regionName',
    label: '所属行政区'
  },
  {
    field: 'regionCode',
    label: '行政区划代码'
  },
  {
    field: 'typeName',
    label: '所属分类'
  },
  {
    field: 'typeCode',
    label: '分类代码'
  },
  {
    field: 'longitude',
    label: '经度'
  },
  {
    field: 'latitude',
    label: '纬度'
  },
  {
    field: 'altitude',
    label: '高程'
  },
  {
    field: 'bdewwgm2d',
    label: '北斗网格码2D',
    span: 24
  },
  {
    field: 'bdswwgm3d',
    label: '北斗网格码3D',
    span: 24
  }
])

onMounted(() => {})
</script>

<template>
  <Descriptions :schema="schema" :data="props.currentRow" />
</template>
